

if(WIN32)
  add_executable(svnsrv
    Argv.cc
    Daemonize.cc
    klog.cc
    RouterSeletor.cc
    Runtime.cc
    SubversionHds.cc
    SubversionServer.cc
    SubversionSession.cc
    TOMLParse.cc
    main.cc
    svnsrv.rc
  )
  add_definitions(
    -D_CRT_SECURE_NO_DEPRECATE=1
    -D_CRT_NONSTDC_NO_DEPRECATE=1
  )
else()
  add_executable(svnsrv
    Argv.cc
    Daemonize.cc
    klog.cc
    RouterSeletor.cc
    Runtime.cc
    SubversionHds.cc
    SubversionServer.cc
    SubversionSession.cc
    TOMLParse.cc
    main.cc
)
endif()

configure_file("${CMAKE_SOURCE_DIR}/config/svnsrv.toml" "${EXECUTABLE_OUTPUT_PATH}/svnsrv.toml")
configure_file("${CMAKE_SOURCE_DIR}/config/router.toml" "${EXECUTABLE_OUTPUT_PATH}/router.toml")

if(MSVC)
  target_link_libraries(svnsrv
      shell32
      shlwapi
      boost_thread
      boost_system
      wsock32
      ws2_32
  )
elseif(MINGW)
  target_link_libraries(svnsrv
    shell32
    shlwapi
    boost_system-mt
    boost_thread-mt
    wsock32
    ws2_32
    pthread
  )
else()
  target_link_libraries(svnsrv
      boost_thread
      boost_system
      pthread
  )
endif()



install(TARGETS svnsrv
    DESTINATION bin
)

install(FILES "${CMAKE_SOURCE_DIR}/config/svnsrv.toml"
    DESTINATION bin
)
